const fs = require('fs');

function registryRouter() {
  const paths = fs.readdirSync(__dirname);
  paths.forEach(path => {
    if (path !== 'index.js') {
      const route = require(`./${path}`);
      this.use(route.routes());
      this.use(route.allowedMethods());
    }
  });
}

module.exports = registryRouter;
